Skip to main content
Version: 4.2.1

Grid Component

The dReveal grid is a component compatible with ASP.Net MVC using .Net Framework 4.8.1. The dReveal grid component requires a controller and a view, to follow ASP.Net MVC architecture, in order to visualize it seamlessly in a hosting application with the framework requirements mentioned previously.

Controller

In the controller is required to create an action method to instance a GridViewModel class in it. See the following sample code:

public ActionResult SimpleGrid()
{
GridViewModel viewModel = new GridViewModel(
memoryStream: fileStream,
connectionString: "Data Source=MyServer; Initial Catalog=myDatabase; User ID=myUser; Password=myPassword",
gridId: "grid_id",
htmlFormId: "main_form",
rowsPerPage: 15,
enableColumnFinderFeature: true,
isGridPagerSimpleMode: true,
fullGridControllerActionPath: HttpContext.Request.Url.AbsolutePath,
gridActionName: string.Empty,
drillThroughControllerAction: string.Empty,
saveGridControllerAction: string.Empty,
exportToExcelGridControllerAction: string.Empty
);
viewModel.LoadInitialConfiguration();

return View("ShowGrid", viewModel);
}
note

The memoryStream parameter receives in-memory data represented by a .dRepX file. For further information refer to the GridViewModel documentation.

View

The dReveal grid component provides a method to be able of visualizing it throughout a razor page. It is possible to invoke this method following manner:

@Html.InfoArch().Grid(@Model.GridSettings).GetHtml()

The GridSettings is the parameter required by the method mentioned above and prepared in the controller to load it in the view. See the previous topic for further information about the load process. The following code shows how to use the method in a view:

@using InfoArch.Web.Mvc.Grid

@model GridViewModel

<div id="reporting-grid">
<div id="grid-container">
@Html.InfoArch().Grid(@Model.GridSettings).GetHtml()
</div>
</div>
note

The sample code is assuming that the required static resources (Stylesheets and Scripts files) were incorporated. For further information see the Static Resources documentation.